package org.logic.linguisticSummaries.type23summaries;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

import org.logic.fuzzysets.AFuzzySet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class SummaryTypeTwoContainer {

	private static Logger logger = LoggerFactory.getLogger(SummaryTypeTwoContainer.class);

	protected List<AFuzzySet> quantifiers;
	protected List<AFuzzySet> qualifiers;
	protected List<AFuzzySet> summarizers;
	protected List<String> subjects;

	public SummaryTypeTwoContainer() {
		
		quantifiers = new ArrayList<AFuzzySet>();
		qualifiers = new ArrayList<AFuzzySet>();
		subjects = new ArrayList<String>();
		summarizers = new ArrayList<AFuzzySet>();
	}

	public void addQuantifier(AFuzzySet quantifier) {
		quantifiers.add(quantifier);
	}

	public void addQualifier(AFuzzySet qualifier) {
		qualifiers.add(qualifier);
	}
	
	public void addSummarizer(AFuzzySet summarizer) {
		summarizers.add(summarizer);
	}

	public void addSubject(String subject) {
		subjects.add(subject);
	}

	public Map<Double,String> generateAllSummaries() {
		
		logger.info("\n============================ TYPE 2 ============================");
		Map<Double,String> summaries = new TreeMap<Double,String>();

		for (AFuzzySet quantifier : quantifiers) {
			for (String subject : subjects) {
				for (AFuzzySet summarizer : summarizers) {
					for (AFuzzySet qualifier : qualifiers) {
						qualifier.setQualifier(summarizer);
					SummaryTypeTwo summaryTypeTwo = new SummaryTypeTwo(subject, quantifier, qualifier);
					String summary = summaryTypeTwo.generateSummary();
					summaries.put(summaryTypeTwo.getDegreeOfTruth(),summary);
					//logger.info(summary);
				}
			}
		}
	}
		return summaries;
	}

}
